/* Copyright (c) 2009-2010, Sean A.O. Harney <sharney3@gmail.com> */

#ifndef FUZZER_UTIL_H
#define FUZZER_UTIL_H


/* prototypes */
void *checked_malloc(size_t size);
void *checked_calloc(size_t nmemb, size_t size);
char *checked_strdup(const char *s);

//GCC attribute noreturn used so that compiler won't give warnings about uninitialized vars
//in cases where it would when exit is substituted for one of these
void fatal_error() __attribute__ ((noreturn));
void fatal_error_perror(const char *s) __attribute__ ((noreturn));
void fatal_error_strerror(const char *s, int errnum)
    __attribute__ ((noreturn));
void fatal_error_println(const char *fmt, ...) __attribute__ ((noreturn));

void error_print(const char *fmt, ...);
void error_println(const char *fmt, ...);
bool fd_lock(int fd);
bool fd_unlock(int fd);
bool fp_lock(FILE * fp);
bool fp_unlock(FILE * fp);
bool get_omf_running_time(struct timeval *ret);

#endif				/* FUZZER_UTIL_H */
